package com.example.demo.ProxyMode;

/**
 * 场景类(强制代理)
 */
public class Client2 {

    public static void main(String[] args) {

        // 直接调用具体类（不可以）
//        IGamePlayer2 gamePlayer2 = new GamePlayer2("张三");
//        gamePlayer2.login("zhangsan","123");
//        gamePlayer2.killBoss();
//        gamePlayer2.upgrade();

        // 直接调用代理类（不可以）
//        IGamePlayer2 gamePlayer2 = new GamePlayer2("张三");
//        GamePlayerProxy2 proxy2 = new GamePlayerProxy2(gamePlayer2);
//        proxy2.login("zhangsan","123");
//        proxy2.killBoss();
//        proxy2.upgrade();

        // 强制代理
        IGamePlayer2 gamePlayer2 = new GamePlayer2("张三");
        IGamePlayer2 proxy2 = gamePlayer2.getProxy();
        proxy2.login("zhangsan","123");
        proxy2.killBoss();
        proxy2.upgrade();
    }
}
